<template>
  <div class="beauty_recommend">
    <div class="banner">
      <!-- <el-carousel :interval="4000" type="card" height="200px" autoplay= 'true'>
                <el-carousel-item v-for="item in 6" :key="item">
                  <img src="../images/mainOne/index/IMG_shouye_banner.png" />
                </el-carousel-item>
              </el-carousel> -->
      <el-carousel>
        <el-carousel-item v-for="(item,index) in bannerPicData" :key="index" role="true">
          <router-link to="/banner">
            <img v-bind:src="item.src" />
          </router-link>
        </el-carousel-item>
      </el-carousel>
    </div>
    <div class="middle_nav">
      <div class="middle_nav_item">
        <router-link to="/essay">
          精选文章
        </router-link>

      </div>

      <div class="middle_nav_item">
        <router-link to="/activity">
          活动推荐
        </router-link>
      </div>

      <div class="middle_nav_item">
        <router-link to="/sign">
          每日一签
        </router-link>
      </div>

    </div>
    <div class="activity_topic">
      <div class="title">
        <p>
          <img src="../../images/mainOne/index/icon_shouye_xinxing.png" />
          <span>活动专题</span>
          <img src="../../images/mainOne/index/icon_shouye_xinxing.png" />
        </p>
      </div>
<!--遍历生成  -->
      <div class="topic_block" v-for="(item,index) in activityThemeData" :key="index">
        <p class="user_info">
          <img v-bind:src=item.hicon />
          <span class="user_name"> {{ item.name  }}</span>
          <span class="foucs">关注ta</span>
        </p>
        <div class="img_block">
          <img  v-bind:src=item.big_pic />
        </div>
      </div>
<!--遍历生成  -->



    </div>
  </div>
</template>
<script>
export default {
  name: "beauty_recommend",
//初始化数据
      props:{
        name:{
          default:'悦小舞',
        }
      },
//组件创建完成时，发送ajax请求
  created(){
    //发送get请求轮播图图片
    var flag = this.$axios.defaults.baseURL == "http://localhost:3000"
    console.log(this.$axios.defaults.baseURL)
    var url = flag?"/bannerPic":"/bannerPic.json"
    this.$axios.get(url)
      .then(res =>{
          this.bannerPicData =res.data.data
        
      })
      .then(error => {
        console.log(error? error:"");
      })
     //发送get请求活动专题数据
     var url = flag?"/activity_theme":"/activity_theme.json"
     this.$axios.get(url)
      .then(res =>{
        
       
        this.$data.activityThemeData = res.data.data
        console.log(this.activityThemeData)
      })
      .then(error => {
        console.log(error? error:"");
      })
  },

  data() {
    return {
      bannerPicData:[],
      activityThemeData:[],
    }
  },
  
}
</script>
<style lang="less" scoped>
@pub_width: 710/75rem;
@pub_height: 300/75rem;
.beauty_recommend {
  .banner {
    position: relative;
    width: @pub_width;
    height: @pub_height;
  }
  .el-carousel {
    position: absolute;
    top: -130/75rem;
    left: (10rem-710/75rem)/2rem;
    margin: 0 auto;
    width: @pub_width;
    height: @pub_height;
    border-radius: 15px;
    .el-carousel__item {
      width: @pub_width;
      height: @pub_height;
      img {
        width: @pub_width;
        height: @pub_height;
      }
    }
  }
  .middle_nav {
    display: flex;
    justify-content: space-around;
    flex-direction: row;
    border: 1px solid #ccc;
    width: @pub_width;
    margin: 0 auto;
    border-radius: 15px;
    box-shadow: 0px 0px 15px #ccc;
    margin-top: -1rem;
    .middle_nav_item {
      flex-grow: 1;
      text-align: center;
      font-size: 28/75rem;
      line-height: 110px;
      position: relative;
      z-index: 20;
    }
  }
  .activity_topic {
    margin-top: 25/75rem;
    .title {
      text-align: center;
      line-height: 90/75rem;
      color: #333;
      span {
        display: inline-block;
        margin: 0 10/75rem;
        font-size: 30/75rem;
      }
      img {
        display: inline-block;
        width: 20/75rem;
        height: 20/75rem;
        margin: 0 10/75rem;
      }
    }
    .topic_block {
      width: 710/75rem;
      height: 495/75rem;
      border: 1px solid #ccc;
      box-shadow: 0 0 15px #ccc;
      margin: 0 auto;
      border-radius: 15px;
      position: relative;
      margin-bottom: 80/75rem;
      .user_info {
        line-height: 60px;
        margin-bottom: 50/75rem;
        img {
          width: 80/75rem;
          height: 80/75rem;
          position: absolute;
          top: -26/75rem;
          left: 20/75rem;
        }
        .user_name {
          font-size: 30/75rem;
          margin-left: 130/75rem;
        }
        .foucs {
          font-size: 24/75rem;
          display: block;
          float: right;
          border: 1px solid #333;
          border-radius: 40/75rem;
          line-height: 40/75rem;
          width: 130/75rem;
          text-align: center;
          margin-top: 30/75rem;
          margin-right: 30/75rem
        }
      }
      .img_block {
        width: 670/75rem;
        height: 320/75rem;
        margin: 0 auto;
        img {
          width: 670/75rem;
          height: 320/75rem;
        }
      }
    }
    .topic_block:last-child {
      margin-bottom: 200px;
    }
  }
}

</style>
